f = 0
f1 = 0
user = [['yaolan','yaolan618']]
print("####################")
print("# 欢迎使用三乐购物系统 # ")
print("#      1登录        #")
print("#      2注册        #")
print("####################")
_input = input("请输入你要进行的选项：")
while 1:
    if _input == "1" or _input == "登录" or f1:
        _username = input("请输入用户名：")
        _userpasswd = input("请输入密码：")
        for i in user:
            if i[0] == _username and i[1] ==_userpasswd:
                f = 1
                print("登录成功！")
                break
        if f == 0:
            print("登录失败,请重新登录！")
        else:
            break
    elif _input == "2" or _input == "注册":
        while 1:
            _username1 = input("请输入注册的用户名：")
            _user1passwd1 = input("请输入注册的密码：")
            _user1passwd2 = input("请确认注册的密码：")
            if _user1passwd1 == _user1passwd2:
                user.append([_username1,_user1passwd1])
                f1 = 1
                print("请登录：")
                break
            else :
                print("密码输入不一致,请重新输入")
_money = input("请输入充值金额：")
_money = int(_money)
print("充值成功！当前余额：%d"%_money)
goods = {'F00001':{'name':'苹果','price':1.2},'F00002':{'name':'香蕉','price':5.5},'F00003':{'name':'菠萝','price':3.5}}
print("##################商品列表##################")
for i in goods:
    print(i,end = '               ')
    print(goods.get(i).get('name'),end = '               ')
    print(goods.get(i).get('price'))
print("##########################################")
dict1 = {}
while 1:
    f = 0
    i = 0
    for i in goods:
        num = input("请输入购买的商品编号：")
        count = input("请输入购买商品的数量：")
        count = int(count)
        print("123")
        if num == i:
            dict1[num]=  {'name':goods.get(i).get('name'),'price':goods.get(i).get('price'),'count':count}
            f = 1
            buy = input("是否继续购买？：")
            break
    if not f:
        print("输入错误！请重新输入编号")
    if not buy == "是":
        break
print(dict1)

print(dict1)